<?php
namespace Home\Controller;
class NewsController extends HomeController {
    public function index(){
        $page = mt_rand(1,5);
        date_default_timezone_set("PRC");
        $showapi_appid = '30608';  
        $showapi_secret = '0d25d46999c74722b1e53b618b382adb'; 
        $paramArr = array(
             'showapi_appid'=> $showapi_appid,
             'typeId'=> "38",
             'space'=> "day",
             'key'=> "",
             'date'=> "",
             'page'=> $page
        );
        $param = createParam($paramArr,$showapi_secret);
        $url = 'http://route.showapi.com/254-1?'.$param; 
        $result = file_get_contents($url);
        $result = json_decode($result);
        $result = $result->showapi_res_body->pagebean->contentlist;
        $list = array();
        foreach($result as $k => $v){
            $list[$k] = object2array($result[$k]);
        }
        $this->assign('list',$list);
        $this->display();
    }
}